#coding:utf-8
from BeautifulSoup import BeautifulSoup
import urllib
import re

doc = urllib.urlopen('http://www.google.com').read()
soup = BeautifulSoup(''.join(doc))
#print soup.prettify()
#print soup.contents[0].name
print soup.contents[0].contents[0].name

head = soup.contents[0].contents[0]
print head.parent.namge
print head.next
print head.nextSlibling.name
print head.nextSlibling.contents[0]
print head.nextSlibling.contents[0].nextSlibling
